/**
 * Lenovo Group
 * Copyright (c) 1999-2016 All Rights Reserved.
 */
package com.lenovo.lmrp.api.itsmgateway;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import com.lenovo.lmrp.api.model.RestResponse;
import com.lenovo.lmrp.api.model.entity.ProjectExtensePO;
import com.lenovo.lmrp.api.model.entity.ProjectPO;
import com.lenovo.lmrp.api.model.view.ClientVO;
import com.lenovo.lmrp.api.model.view.EngineerVO;
import com.lenovo.lmrp.api.model.view.ProjectVO;
import com.lenovo.lmrp.api.model.view.ServiceProviderVO;
import com.lenovo.sdc.framework.util.PageData;

/**
 * 
 * @author wujin
 * @version v1.0
 */
@Consumes("application/json;charset-utf-8")
@Produces("application/json;charset-utf-8")
public interface IItsmProject {
    /**
     * get project by project id
     * 
     * @param itsmCode
     * @param projectid
     * @return
     */
    @GET
    @Path("/{itsmcode}/projects/{projectid}")
    public RestResponse<ProjectPO> getProject(@PathParam("itsmcode") String itsmCode, 
                                              @PathParam("projectid") String projectid);
    
    /**
     * get project by Ticketid
     * 
     * @param itsmCode
     * @param projectid
     * @return
     */
    @GET
    @Path("/{itsmcode}/projectofticket/{ticketid}")
    public RestResponse<ProjectPO> getProjectByTicketId(@PathParam("itsmcode") String itsmCode, 
                                                        @PathParam("ticketid") String ticketid);
    
    /**
     * find project by project id, name, status
     * 
     * @param itsmCode
     * @param id
     * @param name
     * @param status
     * @param pageVo
     * @return
     */
    @GET
    @Path("/{itsmcode}/projects")
    public RestResponse<PageData<ProjectPO>> listProject(@PathParam("itsmcode") String itsmCode, 
                                                @QueryParam("id") String id,
                                                @QueryParam("name") String name,
                                                @QueryParam("status") String status,
                                                @QueryParam("page") int page,
                                                @QueryParam("limit") int rows);
    /**
     * find engineer who belong to special project.
     * Beside project ID, other parameter can be null
     * 
     * @param itsmCode
     * @param projectID
     * @param groupID
     * @param provinces province list, separate by ','
     * @param citys city list, separate by ','
     * @return
     */
    @GET
    @Path("/{itsmcode}/projects/{projectid}/engineers")
    public RestResponse<List<EngineerVO>> listProjectEngineer(@PathParam("itsmcode") String itsmCode, 
                                            @PathParam("projectid") String projectID,
                                            @QueryParam("groups") String groupID,
                                            @QueryParam("provinces") String provinces,
                                            @QueryParam("citys") String citys);
    
    /**
     * find project list that one engineer is involved
     * 
     * @param itsmCode
     * @param engineerID
     * @param groupID
     * @param provinces
     * @param citys
     * @return
     */
    @GET
    @Path("/{itsmcode}/projects/{engineerid}/projects")
    public RestResponse<List<ProjectVO>> listEngineerProject(@PathParam("itsmcode") String itsmCode, 
                                            @PathParam("engineerid") String engineerID,
                                            @QueryParam("groups") String groupID,
                                            @QueryParam("provinces") String provinces,
                                            @QueryParam("citys") String citys);
    
    /**
     * get Service provider information by id
     * TODO need move to SP API when has more business requirement for it
     * 
     * @param itsmCode
     * @param spid
     * @return
     */
    @GET
    @Path("/{itsmcode}/sp/{spid}")
    public RestResponse<ServiceProviderVO> getServiceProvider(@PathParam("itsmcode") String itsmCode, 
                                            @PathParam("spid") String spid);
    
    /**
     * get client information by client id. Our system don't support create client, this id is created in ITSM.
     * TODO need move to client API when has more business requirement for it
     * 
     * @param itsmCode
     * @param clientid
     * @return
     */
    @GET
    @Path("/{itsmcode}/clients/{clientid}")
    public RestResponse<ClientVO> getClient(@PathParam("itsmcode") String itsmCode, 
                                            @PathParam("engineerid") String clientid);
    
    /**
     * update peoject extprops
     * 
     * @param itsmCode
     * @param projectExtensePO
     * @return
     */
    @PUT
    @Path("/{itsmcode}/projectExtPropsUpdate")
    public RestResponse<ProjectExtensePO> updateProjectExtProps(@PathParam("itsmcode") String itsmCode,
                                                         ProjectExtensePO projectExtensePO);
}
